<template>
	<view>
		<u-navbar :is-back="true" :is-fixed="true" title="黑名单"></u-navbar>
		<scroll-view scroll-y scroll-with-animation style="height: calc(100vh - 50px);" :show-scrollbar="false">
			<view class="mt-3 pl-2 pr-2">
				<view v-for="(item, itemIndex) in tabContents" :key="itemIndex">

					<view class="u-line pb-2 mt-1" @click="open('')">
						<view class="dfex ">
							<view>{{item.name}}</view>
							<view>2024-2-16</view>
						</view>
						<view class="mt-2 text-999999 font-12">华东政法大学</view>
					</view>

				</view>
			</view>
		</scroll-view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				tabContents: [{
						name: '内容1',
						Image: '/static/logo.png',
						fouShu: 100
					},
					{
						name: '内容2',
						Image: '/static/logo.png',
						fouShu: 200
					},
					{
						name: '内容2',
						Image: '/static/logo.png',
						fouShu: 200
					},
					{
						name: '内容2',
						Image: '/static/logo.png',
						fouShu: 200
					}

				],
				pageNo:1,
				pageSize:10
			}
		},

		onLoad() {
			this.getBlackList(this.pageNo, this.pageSize);
		},
		onReachBottom() {
			this.pageNo = this.pageNo + 1;
			this.getBlackList(this.pageNo, this.pageSize);
		},
		methods: {
			open(path) {
				uni.navigateTo({
					url: '/pages/' + path
				})
			},
			getBlackList(no, size) {
				$H.get('/agriculture/blacklist/upper/list', {
						pageNo: no,
						pageSize: size
					}, {})
					.then(res => {
						if(res.result.records.length==0){
							uni.showToast({
								title: '没有更多啦！',
								icon: 'success'
							});
							return;
						}
						const noticeList = [];
						for (let i = 0; i < res.result.records.length; i++) {
							if (res.result.records[i].title) {
								noticeList.push({
									id:res.result.records[i].id,
									title: res.result.records[i].title,
									isRead: res.result.records[i].isRead
								});
							}
						}
						this.notices = noticeList;
					})
					.catch(error => {
						console.error('请求出错', error); // 处理任何错误  
					});
			}
		}
	}
</script>

<style>

</style>